package com.xh.demo.controller;

import com.xh.demo.commons.model.response.R;
import com.xh.demo.feign.OrderServiceFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wen
 * @apiNote TestController
 * @since 2021-12-10
 */
@Slf4j
@RefreshScope
@RestController
@RequestMapping("/test")
public class TestController {

    @Value("${normal-app:UN_KNOW}")
    private String mallDescribe;
    @Autowired
    private OrderServiceFeign orderServiceFeign;

    @GetMapping("/index")
    public R<String> index() {
        log.info("【订单描述】【{}】", mallDescribe);
        return R.success(mallDescribe);
    }

    @GetMapping("/order/detail/{id}")
    public R<String> orderDetail(@PathVariable("id") Long orderId) {
        return orderServiceFeign.detail(orderId);
    }


}
